<?php
declare (strict_types = 1);

namespace app\www\controller;

class Content extends WwwBase
{
    protected function initialize()
    {
        parent::initialize();
        $this->model = new \app\common\model\Content;
        $this->validate = new \app\common\validate\Content;
        $this->order = 'id desc';
    }
    public function index()
    {
        // 分页容量
        $page_size = $this->request->param('page_size/d',$this->page_size);
        $res = $this->model->order($this->order)->paginate($page_size);
        return json($res);
    }
    public function read($id)
    {
        $res = $this->model->where('id', $id)->find();
        return json($res);
    }
}
